home *** CD-ROM | disk | FTP | other *** search
/ Mac Mania 4 / MacMania 4.toast / / Demo's / Igor Demo Pro / 1 PutContentsIn Igor Pro Folder / WaveMetrics Procedures / Graphing / Remove Axis Proc < prev    next >
Text File  |  1996-01-30  |  1KB  |  64 lines

  1. // Remove Axis Proc, Version 1.1, LH951107
  2.  
  3. // Version 1.1 created to be liberal name aware and data folder savvy
  4.  
  5. #include <Strings as Lists>
  6. #include <Keyword-Value>
  7. //#include <Graph Utility Procs>
  8.  
  9.  
  10. #pragma rtGlobals=1        // This mainly acts as notice that this proc is Igor 3.0 savvy
  11.  
  12.  
  13. Macro RemoveAxis(axName)
  14.     String axName="left"
  15.     Prompt axName,"axis to remove",popup AxisList("")
  16.     
  17.     DoRemoveAxis(axName)
  18. End
  19.  
  20. Proc DoRemoveAxis(axName)
  21.     String axName
  22.     
  23.     PauseUpdate; Silent 1
  24.  
  25.     String axInfo= AxisInfo("",axName),axType
  26.     axType= StrByKey("AXTYPE",axInfo)
  27.     if( strlen(axType) == 0 )
  28.         Abort "FOOBAR"                        | sanity check, from now on we ASSUME things work
  29.     endif
  30.     Variable isX= (CmpStr("bottom", axType)==0 ) %|  (CmpStr("top", axType)==0 )
  31.  
  32.     String tracesOnGraph
  33.     String theTrace,tInfo
  34.     String key1
  35.     Variable i,didOne
  36.     
  37.     do
  38.         didOne= 0
  39.         i= 0
  40.         tracesOnGraph= TraceNameList("", ";", 1)        // we have to get this fresh each time we remove a trace since the instance numbers change
  41.         do
  42.             theTrace= GetStrFromList(tracesOnGraph,i,";")
  43.             if( strlen(theTrace) == 0 )
  44.                 break;
  45.             endif
  46.             
  47.             do
  48.                 tInfo= TraceInfo("",theTrace,0)
  49.                 if( isX )
  50.                     key1= "XAXIS"
  51.                 else
  52.                     key1= "YAXIS"
  53.                 endif
  54.                 if( CmpStr(axName,StrByKey(key1,tInfo))== 0 )
  55.                     RemoveFromGraph $theTrace
  56.                     didOne= 1
  57.                 endif
  58.             while(0)
  59.                 
  60.             I+=1
  61.         while(1)
  62.     while(didOne)
  63. end
  64.